<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Category_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category_id" data-rule="required" data-source="litestoreshopcategory/selectpage"   class="form-control selectpage" name="row[category_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-desc" data-rule="required" class="form-control" name="row[desc]" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Res point')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-res_point" data-rule="required" class="form-control" name="row[res_point]" type="number" max="100">
        </div>
    </div>


    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">{:__('标签')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_checkboxs('tags[]', $tagList)}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('所属区域')}:</label>
        <div class="col-xs-12 col-sm-8">

            <div class="form-inline" data-toggle="cxselect" data-selects="province,city,area">
                <select class="province form-control" name="row[province]" data-url="ajax/rowarea"></select>
                <select class="city form-control" name="row[city]" data-url="ajax/rowarea"></select>
                <select class="area form-control" name="row[area]" data-url="ajax/rowarea"></select>
            </div>


        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('地图选点')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input type="button" id="selectBtn" value="地图选点">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="address" data-rule="required"  class="form-control" name="row[address]" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-longitude" class="form-control" name="row[longitude]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-latitude" class="form-control" name="row[latitude]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('经/纬度')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="location" class="form-control" name="row[location]" type="text">
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" data-params='{"custom[is_shop]":"1"}' class="form-control selectpage" name="row[user_id]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Shop_image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-shop_image" data-rule="required" class="form-control" size="50" name="row[shop_image]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-shop_image" class="btn btn-danger plupload" data-input-id="c-shop_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-shop_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-shop_image" class="btn btn-primary fachoose" data-input-id="c-shop_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-shop_image"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-shop_image"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Shop_images')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-shop_images" class="form-control" size="50" name="row[shop_images]" type="text">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-shop_images" class="btn btn-danger plupload" data-input-id="c-shop_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-shop_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-shop_images" class="btn btn-primary fachoose" data-input-id="c-shop_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-shop_images"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-shop_images"></ul>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Info')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-info" data-rule="required" class="form-control editor form-control" rows="5" name="row[info]" cols="50"></textarea>
        </div>
    </div>


    <div class="form-group">
        <label for="content" class="control-label col-xs-12 col-sm-2">{:__('推荐位')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_checkboxs('posids[]', $posidList)}
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="0"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script src="/map/js/selectLocation.js"></script>
<script type="text/javascript">
    SelectLocation.init({
        id:'selectBtn',     //打开地图窗口按钮的ID
        url:'/map/bdMap.html',   //地图页面的地址
//        width:'1024',        //打开地图窗口的宽度,可不传
//        height:'800',        //打开地图窗口的高度,可不传
//        top:'50',            //打开地图窗口距显示器顶部的距离,可不传
//        left:'100',          //打开地图窗口显示器左边的距离,可不传
        callback:function(selectedLocation){
            var address = document.getElementById('address');
            var location = document.getElementById('location');

            $(address).attr('value',selectedLocation.gpsAddr);
            $(location).attr('value',selectedLocation.location);

            var arr = selectedLocation.location.split(",");
            $('#c-longitude').attr('value',arr[0]);
            $('#c-latitude').attr('value',arr[1]);
        }
    });
</script>
